// 创建路由器
import VueRouter from "vue-router";

// pages目录下存放的是路由组件
// components目录下存放的是一般组件
import About from "../pages/About";
import Home from "../pages/Home";
import Message from "../pages/Message.vue";
import News from "../pages/News.vue";

export default new VueRouter({
  // 注意此处是routes,不是routers
  routes: [
    // 一级路由
    {
      path: "/about",
      component: About,
    },
    {
      path: "/home",
      component: Home,
      children: [
        // 通过children 配置子级路由
        {
          path: "message", // 二级路由，path 路径名最前面不需要加反斜杠
          component: Message,
        },
        {
          path: "news", // 二级路由，path 路径名最前面不需要加反斜杠
          component: News,
        },
      ],
    },
  ],
});
